package com.example.djetpack.lifecycle

import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import androidx.fragment.app.Fragment
import androidx.lifecycle.Lifecycle
import androidx.lifecycle.LifecycleOwner
import androidx.lifecycle.LifecycleRegistry
import com.example.djetpack.R

class LifecycleActivity : AppCompatActivity() {
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_lifecycle)

        lifecycle.addObserver(LocationObserver1())
        lifecycle.addObserver(LocationObserver2())
    }
}

/*
class MyFragment : LifecycleOwner{

    private val lifecycleRegistry : LifecycleRegistry = LifecycleRegistry()

    override fun getLifecycle(): Lifecycle {
        return lifecycleRegistry
    }

    fun performCreate(){
        lifecycleRegistry.handleLifecycleEvent(Lifecycle.Event.ON_CREATE);
    }

    fun performStart(){
        lifecycleRegistry.handleLifecycleEvent(Lifecycle.Event.ON_START);
    }

    fun performResume(){
        lifecycleRegistry.handleLifecycleEvent(Lifecycle.Event.ON_RESUME);
    }

}*/
